﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;

namespace PowerManager.WinformTest
{
    public partial class Form1 : Form
    {
        SysInfoShowModel info = new SysInfoShowModel();
        public Form1() {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
        }

        private void Form1_Load(object sender, EventArgs e) {
            info.BindingTo(IPAddress.Parse("127.0.0.1"));
            label1.DataBindings.Add(new Binding("Text", info, "UpTime"));
            var bindingSource = new BindingSource();
            bindingSource.DataSource = info;
            dataGridView1.DataSource = bindingSource;
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
        }

        private void button1_Click(object sender, EventArgs e) {
            label1.Text = info.UpTime;
        }
    }
}
